<template>
  <div>
    <el-col :span="12">
      <el-card class="header" style="height:200px;" shadow="always">
         <el-row class="title">任务完成情况分布</el-row>
         <el-row class="layouts_one">
           <div id="main1"></div>
         </el-row>
      </el-card>
    </el-col>
  </div>
</template>

<script>
  import * as echarts from 'echarts';
  export default {
     data() {
        return {
          datalist:[]
        }
     },
     created() {
       var list = ["xiaoming","lisi","wangwu","lisai","nma","xiaoming","lisi","wangwu","lisai","nma","xiaoming","lisi","wangwu","lisai","nma"]
       this.datalist = list;
     },
     mounted(){
      const myChart1 = echarts.init(document.getElementById('main1'));
      myChart1.setOption({
      tooltip: {
        trigger: 'item'
      },
      legend: {
        orient: 'vertical',
        left: 'right',
        top: '120px'
      },
  series: [
    {
      name: 'Access From',
      type: 'pie',
      radius: ['35%', '60%'],
      center: ['50%', '45%'],
      avoidLabelOverlap: false,
      itemStyle: {
        borderRadius: 10,
        borderColor: '#fff',
        borderWidth: 2
      },
      label: {
        show: false,
        position: 'center'
      },
      emphasis: {
        label: {
          show: true,
          fontSize: 13,
          fontWeight: 'bold'
        }
      },
      labelLine: {
        show: true
      },
      data: [
        { value: 735, name: '未完结' ,itemStyle: { color: '#F4CE98' } },
        { value: 1048, name: '已完结',itemStyle: { color: '#93D2F3' }  },
        { value: 500, name: '未发布'}
      ],
      label: {
          show: true,
          formatter: '{b}: {c}' // {b} 表示 name，{c} 表示 value
       }
     }]
    });
  }
}
</script>

<style lang="less" scoped>
// 第一个图标的card
.header {
  margin-bottom:15px;
  padding: 20px;
  .title {
    font-weight: bolder;
    padding-left: 12px;
    border-left: 6px solid rgb(124, 148, 237);
  }
  .item {
    margin-top: 30px;
    width: 154px;
    height: 80px;
    margin-left: 22px;
    color: white;
    // background-color: pink;
    border-radius: 5px;
  }
  .item_li {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  .item_li span:first-child {
      font-size: 24px;
      margin-top: 15px;
      margin-bottom: 5px;
      align-self: center;
    }

   .item_li span:last-child {
      display: flex;
      font-size: 16px;
    }
}

.layouts {
  margin-right: 15px;
  .layouts_one {
     display: flex;
     justify-content: center;
     align-items: center;
  }

}

/deep/ .el-col-4 {
  margin-right: 38px;
}

#main1 {
  height: 300px;
  width: 100%;
  margin-top: -50px;
}
</style>
